﻿// DlgSetSpeed.cpp: 实现文件
//

#include "stdafx.h"
#include "GHCY.h"
#include "DlgSetSpeed.h"
#include "afxdialogex.h"


// DlgSetSpeed 对话框

IMPLEMENT_DYNAMIC(DlgSetSpeed, CDialogEx)

DlgSetSpeed::DlgSetSpeed(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_SETSPEED, pParent)
	, m_nSlowSpeed(0)
	, m_nRunSpeed(0)
{

}

DlgSetSpeed::~DlgSetSpeed()
{
}

void DlgSetSpeed::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_nSlowSpeed);
	DDX_Text(pDX, IDC_EDIT2, m_nRunSpeed);
}


BEGIN_MESSAGE_MAP(DlgSetSpeed, CDialogEx)
	ON_BN_CLICKED(IDOK, &DlgSetSpeed::OnBnClickedOk)
END_MESSAGE_MAP()


// DlgSetSpeed 消息处理程序


BOOL DlgSetSpeed::OnInitDialog()
{
	m_nRunSpeed = theApp.m_nRunSpeed;
	m_nSlowSpeed = theApp.m_nSlowSpeed;

	CDialogEx::OnInitDialog();

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void DlgSetSpeed::OnBnClickedOk()
{
	UpdateData();
	theApp.setSysInt(L"m_nRunSpeed", (int&)m_nRunSpeed);
	theApp.setSysInt(L"m_nSlowSpeed", (int&)m_nSlowSpeed);
	theApp.m_nRunSpeed = m_nRunSpeed;
	theApp.m_nSlowSpeed = m_nSlowSpeed;

	CDialogEx::EndDialog(IDOK);
}
